package com.ekuaitu.kuaitu.activity;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ekuaitu.kuaitu.R;
import com.ekuaitu.kuaitu.api.UrlConstant;
import com.ekuaitu.kuaitu.base.BaseActivity;
import com.ekuaitu.kuaitu.utils.IntentKey;
import com.ekuaitu.kuaitu.utils.KuaituDialog;
import com.ekuaitu.kuaitu.utils.MyApplication;
import com.ekuaitu.kuaitu.utils.StatusBarUtil;
import com.zhy.autolayout.AutoRelativeLayout;

import butterknife.BindView;
import butterknife.OnClick;

public class MyStaffActivity extends BaseActivity {

    @BindView(R.id.return_myStaff)
    ImageView returnMyStaff;
    @BindView(R.id.toolbar_myStaff)
    AutoRelativeLayout toolbarMyStaff;
    @BindView(R.id.myStaff_problem)
    AutoRelativeLayout myStaffProblem;
    @BindView(R.id.myStaff_guide)
    AutoRelativeLayout myStaffGuide;
    @BindView(R.id.myStaff_complain)
    AutoRelativeLayout myStaffComplain;
    @BindView(R.id.myStaff_contact)
    AutoRelativeLayout myStaffContact;
    @BindView(R.id.myStaff_tv_phone)
    TextView myStaffTvPhone;
    @BindView(R.id.myStaff_phone)
    AutoRelativeLayout myStaffPhone;
    @BindView(R.id.myStaff_tv_email)
    TextView myStaffTvEmail;
    @BindView(R.id.myStaff_email)
    AutoRelativeLayout myStaffEmail;
    @BindView(R.id.progress_bar_myStaff)
    RelativeLayout progressBarMyStaff;
    private Context mContext = this;

    @Override
    public int getLayoutId() {
        return R.layout.activity_my_staff;
    }

    @Override
    public void initView() {
        StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimaryWhite), 0, true);
        myStaffTvPhone.setText(MyApplication.getInstance().getHotLine());
    }

    @OnClick({R.id.return_myStaff, R.id.myStaff_problem, R.id.myStaff_guide, R.id.myStaff_complain, R.id.myStaff_tv_phone, R.id.myInfo_about, R.id.myStaff_tv_email})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.return_myStaff:
                finish();
                break;
            case R.id.myStaff_problem:
                Intent intent = new Intent(mContext, WebViewActivity.class);
                intent.putExtra(IntentKey.INTENT_WEBVIEW_TITLE, "常见问题");
                intent.putExtra(IntentKey.INTENT_WEBVIEW_URL, UrlConstant.Request.COMMON_QUESTION);
                startActivity(intent);
                break;
            case R.id.myStaff_guide:
                Intent intent2 = new Intent(mContext, WebViewActivity.class);
                intent2.putExtra(IntentKey.INTENT_WEBVIEW_TITLE, "用户指南");
                intent2.putExtra(IntentKey.INTENT_WEBVIEW_URL, UrlConstant.Request.USER_GUIDE);
                startActivity(intent2);
                break;
            case R.id.myStaff_complain:
                startActivity(new Intent(MyStaffActivity.this, ComplaintsActivity.class));
                break;
            case R.id.myInfo_about:
                Intent intent3 = new Intent();
                intent3.setClass(mContext, AboutActivity.class);
                startActivity(intent3);
                break;
            case R.id.myStaff_tv_phone:
                final KuaituDialog kuaituDialog2 = new KuaituDialog(mContext);
                kuaituDialog2.setTitle(getString(R.string.dialogTitle));
                kuaituDialog2.setMessage("是否拨打客服电话" + MyApplication.getInstance().getHotLine());
                kuaituDialog2.setYesOnclickListener("确定", new KuaituDialog.onYesOnclickListener() {
                    @Override
                    public void onYesClick() {
                        Intent intent3 = new Intent();
                        intent3.setAction(Intent.ACTION_DIAL);
                        intent3.setData(Uri.parse("tel:" + MyApplication.getInstance().getHotLine()));
                        startActivity(intent3);
                        kuaituDialog2.dismiss();
                    }
                });
                kuaituDialog2.setNoOnclickListener("取消", new KuaituDialog.onNoOnclickListener() {
                    @Override
                    public void onNoClick() {
                        kuaituDialog2.dismiss();
                    }
                });
                kuaituDialog2.show();
                break;
        }
    }
}
